package org.csu.mypetstoreplus.persistence;

import org.csu.mypetstoreplus.entity.LineItem;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface LineItemDao extends JpaRepository<LineItem, Integer> {
    @Query(value = "select * from lineitem where orderid =?1", nativeQuery = true)
    List<LineItem> findByOrderId(int orderId);
    @Query(value = "select * from lineitem where itemId =?1", nativeQuery = true)
    List<LineItem> findByItemId(int itemId);
    @Query(value = "select * from lineitem where quantity = ?1", nativeQuery = true)
    int getQuantity(int quantity);
}
